import time
def bubble_sort(nums):
    swapped=True
    while swapped:
        swapped=False
        for i in range(len(nums)-1):
            if nums[i]>nums[i+1]:
                nums[i],nums[i+1]=nums[i+1],nums[i]
                swapped=True
def readlist(filename):
    file=open(filename,'r')
    data=file.readlines()
    return data
q1=readlist('q1.txt')
q2=readlist('q2.txt')
q3=readlist('q3.txt')

tst=time.time()
bubble_s(q1)
tfn=time.time()
print('q1', round((tfn-tst)*1000), 'milleseconds')

tst=time.time()
bubble_s(q2)
tfn=time.time()
print('q2', round((tfn-tst)*1000), 'milleseconds')

tst=time.time()
bubble_s(q3)
tfn=time.time()
print('q3', round((tfn-tst)*1000), 'milleseconds')



